package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;

class ztb {
   private zol a;
   private HashMap b;
   private ArrayList c;

   ztb(zol var1) {
      this.a = var1;
      this.b = new HashMap();
      this.c = new ArrayList();

      for(int var2 = 0; var2 < this.a.a.getComments().getCount(); ++var2) {
         Comment var3 = this.a.a.getComments().get(var2);
         if (this.b.get(var3.getAuthor()) == null) {
            this.b.put(var3.getAuthor(), zase.y(this.c.size()));
            com.aspose.cells.b.a.a.ze.a(this.c, (Object)var3.getAuthor());
         }
      }

   }

   void a(zcfx var1) throws Exception {
      var1.b(true);
      var1.b("comments");
      if (zase.a) {
         var1.a("xmlns", zase.c);
      } else {
         var1.a("xmlns", zase.d);
      }

      var1.b("authors");

      int var2;
      for(var2 = 0; var2 < this.c.size(); ++var2) {
         var1.b("author");
         var1.a((String)this.c.get(var2));
         var1.b();
      }

      var1.b();
      var1.b("commentList");

      for(var2 = 0; var2 < this.a.a.getComments().getCount(); ++var2) {
         Comment var3 = this.a.a.getComments().get(var2);
         this.a(var1, var3);
      }

      var1.b();
      var1.b();
      var1.d();
      var1.e();
   }

   private void a(zcfx var1, Comment var2) throws Exception {
      var1.b("comment");
      String var3 = CellsHelper.columnIndexToName(var2.getColumn()) + (var2.getRow() + 1);
      var1.a("ref", var3);
      var1.a("authorId", (String)this.b.get(var2.getAuthor()));
      var1.b("text");
      Font var4 = var2.d();
      if (var2.b().p() != null && var2.b().p().size() != 0) {
         int var5 = var2.b().p().size();

         for(int var6 = 0; var6 < var5; ++var6) {
            FontSetting var7 = (FontSetting)var2.b().p().get(var6);
            Font var8 = var7.c();
            if (var8 == null) {
               var8 = var4;
            }

            String var9 = var2.b().i().substring(var7.getStartIndex(), var7.getStartIndex() + var7.getLength());
            this.a(var1, var8, var9);
         }
      } else {
         this.a(var1, var4, var2.b().i());
      }

      var1.b();
      var1.b();
   }

   private void a(zcfx var1, Font var2, String var3) throws Exception {
      var1.b("r");
      if (var2 != null) {
         var1.b("rPr");
         zty.a(var2, var1, "rFont");
         var1.b();
      }

      var1.b("t");
      if (var3 != null && zase.al(var3)) {
         var1.a("xml:space", (String)null, "preserve");
      }

      String var4 = zase.a(var3);
      var1.a(var4);
      var1.b();
      var1.b();
   }
}
